import request from "@/utils/request.js";

const url = '/cloud-sys-service/sys-role'

/**
 * 获取字典类型列表
 */
export function list(data) {
	return request({
		url: url + "/list",
		method: "post",
		data
	});
}

/**
 * 新增或修改字典类型
 */
export function save(data) {
	return request({
		url: url + "/save",
		method: "post",
		data
	});
}

/**
 * 保存角色权限
 */
export function saveAuth(roleId,data) {
	return request({
		url: url + `/saveAuth/${roleId}`,
		method: "post",
		data
	});
}

/**
 * 删除字典类型
 */
export function remove(id) {
	return request({
		url: url + `/remove/${id}`,
		method: "get",
	});
}

/**
 * 根据角色获取菜单ids
 */
export function listMenuIds(params) {
	return request({
		url: url + `/listMenuIds`,
		method: "get",
		params
	});
}

/**
 * 下拉角色列表
 */
export function listRoleOptions() {
	return request({
		url: url + "/listRoleOptions",
		method: "get",
	});
}

// 列表相关列信息
export const columnInfo = [
	{
		"title":"角色名称",
		"field":"name",
		"fixed":"left",
		"align":"center",
		"minWidth":"100"
	},
	{
		"title":"角色编码",
		"field":"code",
		"align":"center",
		"minWidth":"100"
	},
	{
		"title":"状态",
		"field":"status",
		"align":"center",
		"proxyColumn":true,
		"width":"80"
	},
	{
		"title":"排序",
		"field":"sort",
		"align":"center",
		"width":"80"
	},
	{
		"title":"操作",
		"field":"operate",
		"fixed":"right",
		"align":"center",
		"proxyColumn":true,
		"minWidth":"220px",
	}
]